<template>
  <div>
    <h6 class="list_title">
      <img src="@/assets/images/shu_03.jpg" alt />
      <span>建设单位人员考勤概览</span>
    </h6>
    <div class="table_builders">
      <!-- <ul class="s_thead cl">
        <li class="thead_li thead_li1">姓名</li>
        <li class="thead_li thead_li1">健康状况</li>
        <li class="thead_li">所在地</li>
        <li class="thead_li">所属父项目名称</li>
        <li class="thead_li">所属子项目名称</li>
      </ul>
      <ul class="s_tbody cl" v-for="item in tableData" :key="item.id">
        <li class="tbody_li tbody_li1">{{item.name}}</li>
        <li class="tbody_li tbody_li1">{{item.perResult}}</li>
        <li class="tbody_li tbody_li2">{{item.provinces}}{{item.city}}{{item.town}}</li>
        <li class="tbody_li">{{item.parentProjName}}</li>
        <li class="tbody_li">{{item.subProjName}}</li>
      </ul>-->
      <el-table :data="tableData" stripe style="width: 100%" :header-cell-style="{fontWeight:500}">
        <!-- <el-table-column align="center" type="index" label="序号" width="90"></el-table-column> -->
        <el-table-column align="center" prop="parentProjName" label="父项目名称" min-width="120"></el-table-column>
        <el-table-column align="center" prop="subProjName" label="子项目名称" min-width="120"></el-table-column>
        <el-table-column align="center" prop="name" label="姓名" min-width="100"></el-table-column>
        <el-table-column align="center" prop="isWork" label="到岗情况" min-width="100"></el-table-column>
        <el-table-column align="center" prop="perResult" label="健康状况" min-width="100"></el-table-column>
      </el-table>
    </div>
    <div class="fenye" style="float:right">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[6]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<style lang="scss" scoped>
@import "@/style/epidemicrisk/alllist.scss";
@import "@/style/epidemicrisk/list_builders.scss";
</style>

<script>
import { builderskaoqinbyid } from "@/service/epidemicrisk/index.js";
export default {
  data() {
    return {
      currentPage: 1,
      total: 0,
      tableData: []
    };
  },
  created() {
    var pagesize = 6;
    var userId = window.sessionStorage.getItem("id");
    builderskaoqinbyid(this.currentPage, pagesize, userId).then(res => {
      window.console.log(res);
      this.tableData = res.data.obj.records;
      this.total = res.data.obj.total;
    });
  },
  methods: {
    handleSizeChange(val) {
      window.console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      // window.console.log(`当前页: ${val}`);
      var pagesize = 6;
      var userId = window.sessionStorage.getItem("id");
      builderskaoqinbyid(val, pagesize, userId).then(res => {
        window.console.log(res);
        this.tableData = res.data.obj.records;
        this.total = res.data.obj.total;
      });
    }
  }
};
</script>
